<?php
/**
 *  Generic "Single" Model: the single-row table access
 *
 *
 */
namespace Yz\modules\Generic;

class Model_Single
    extends Model_Abstract
{


    /************************************
     *          Public methods          *
     ************************************/


    /**
     *  fetch an item from database
     *  @return Yz_Item_Interface/Item_Default
     *  @throw Yz_Exception_ItemNotFound
     */
    public function fetchItem()
    {
        debug();

        $action = $this->selectAction('Fetch');

        return $this->_fetch($action);
    }


    /**
     *  updateItem
     *
     */
    public function updateItem(\Yz_Item_Interface $item)
    {
        debug();

        $action = $this->selectAction('Update');

        return $this->_update($item, $action);
    }

    /**
     *
     *  @todo The single row may not be created ???
     */
    public function createItem()
    {
        debug();
        throw new \Yz_Exception("The single row must exist");
    }

    /**
     *
     *  @todo The single row may not be deleted ???
     *
     */
    public function deleteItem($item)
    {
        debug();
        throw new \Yz_Exception("The single row may not be deleted");
    }

}
